package cn.ad.enumration;

import java.util.Map;

public enum Education {
	

	JUNIOR(1,"JUNIOR"),//初中及以下
	SENIOR(2,"SENIOR"),  //高中（中专）
	COLLEGE(4,"COLLEGE"),//大学中专
	BACHELOR(8,"BACHELOR"),//大学本科
	MASTER(16,"MASTER");  //硕士及以上
//    DOCTOR(32,"DOCTOR");  //博士
	
    private static java.util.HashMap<String,Integer> mappings;

    private synchronized static java.util.HashMap<String, Integer> getMappings() {
        if (mappings == null) {
            mappings = new java.util.HashMap<String, Integer>();
            for (Education format : Education.values()) {
                mappings.put(format.name, format.value);
            }
        }
        return mappings;
    }


    private String name;
    private int value;

    private Education(int value,String name) {
        this.name = name;
        this.value = value;
    }

    public String getName() {
        return name;
    }

	public int getValue() {
		return value;
	}
	
	 public static Map<String,Integer> getMapping(){
	        return getMappings();
	 }
	 /**
	  * 枚举name值转换成对应的描述
	  * @param str
	  * @return
	  */
	 public static String enToCn(String str) {
		switch (str) {
			case "JUNIOR":return "初中及以下";
			case "SENIOR":return "高中（中专）";
			case "COLLEGE":return "大学中专";
			case "BACHELOR":return "大学本科";
			case "MASTER":return "硕士及以上";
			default: return str;
		}
	 }
	
}
